package com.atguigu1.one.exer2;

import java.util.Scanner;

/**
 * ClassName: ArrayExer02
 * Package: com.atguigu1.one.exer2
 * Description:
 *
 * @Author xiao_qi
 * @Create 2023/12/20 17:14
 * @Version 1.0
 */

/*案例：输出英文星期几

        用一个数组，保存星期一到星期天的7个英语单词，从键盘输入1-7，显示对应的单词
        {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}

        拓展：一年12个月的存储

        用一个数组，保存12个月的英语单词，从键盘输入1-12，显示对应的单词。
        {"January","February","March","April","May","June","July","August","September","October","November","December"}
*/
public class ArrayExer02 {
    public static void main(String[] args){
        //定义七个单词数组
        String[] week = new String[]{"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};

        String[] mouth = new String[]{"January","February","March","April","May","June","July","August","September","October","November","December"};
        //调用scanner函数
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入数值（1-7）：");
        System.out.println("请输入数值（1-12）：");
        int day = scan.nextInt();
       int mouth1 =scan.nextInt();

        //针对输出
        if(day < 1 || day > 7){
            System.out.println("你输入有误:");
        }else {
            System.out.println(week[day - 1]);
        }

        if(mouth1 < 1 || mouth1 > 12){
            System.out.println("你输入有误:");
        }else {
            System.out.println(mouth[mouth1 - 1]);
        }
        scan.close();
        }}



